package com.molichuxing.gateway.bff.advertising.convertor;


import com.molichuxing.gateway.bff.advertising.response.AdvertisingInfoVo;
import com.molichuxing.services.infrastructure.dto.response.AdvertisingInfoDto;
import org.springframework.beans.BeanUtils;

import java.util.ArrayList;
import java.util.List;

public class Convert {


    public static List<AdvertisingInfoVo> toAdvertisingInfoVo(List<AdvertisingInfoDto> dtoList) {
        List<AdvertisingInfoVo> voList = null;
        if (dtoList != null && dtoList.size() > 0) {
            voList = new ArrayList<>();
            for (AdvertisingInfoDto bean : dtoList) {
                voList.add(toAdvertisingInfoVo(bean));
            }
        }

        return voList;
    }

    private static AdvertisingInfoVo toAdvertisingInfoVo(AdvertisingInfoDto dto) {
        AdvertisingInfoVo vo = null;
        if (dto != null) {
            vo = new AdvertisingInfoVo();
            BeanUtils.copyProperties(dto, vo);
        }

        return vo;
    }
}
